package org.codert.wxpay.support.properties;

import lombok.Getter;
import lombok.Setter;
import org.codert.wxpay.support.ConstantEnum;
import org.springframework.boot.context.properties.ConfigurationProperties;

/**
 * @author: TanJingyu
 * @create: 2021-08-11 13:55
 **/
@ConfigurationProperties(prefix = "wx.pay")
@Getter
@Setter
public class WxPayProperties {
    private Identification identification;
    private Connection connection;

    @Getter
    @Setter
    public static class Identification {
        /**
         * 公众号appid.
         */
        private String appId;
        /**
         * 商户号.
         */
        private String merchantId;
        /**
         * 商户API证书的证书序列号。
         */
        private String merchantSerialNumber;
        /**
         * 商户API私钥位置
         */
        private PrivateKey privateKey;
        /**
         * api V3密钥
         * https://pay.weixin.qq.com/wiki/doc/apiv3/wechatpay/wechatpay3_2.shtml
         */
        private String apiV3Key;
        /**
         * 微信支付异步回掉地址.
         * https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter3_3_5.shtml
         */
        private String notifyUrl;

        @Getter
        @Setter
        public static class PrivateKey {
            /**
             * 存储类型
             * 1为字符串。
             * 其他值为在一个文件中。
             */
            private ConstantEnum type;
            private String value;
        }
    }

    @Getter
    @Setter
    public static class Connection {
        private Long timeOut;
    }
}
